
$(document).ready(function(){

    $("#modifypwd").validate({
		rules:{
			oldpwd:{
				required:true
			},
			newpwd:{
				required:true,
                maxlength:24,
                minlength:3
			},
			newpwd1:{
				required:true,
                maxlength:24,
                minlength:3,
                equalTo:newpwd
			},
            nickname:{
                required:true,
                maxlength:12,
                minlength:3
            },
            companyname:{
                required:true,
                maxlength:24,
                minlength:3
            },
            email:{
                required:true,
                maxlength:24,
                minlength:3,
                email: true
            },
            phonenumber:{
                required:true,
                maxlength:24,
                minlength:3,
                number:true
            }
		},
		errorClass: "help-inline",
		errorElement: "span",
		highlight:function(element, errorClass, validClass) {
			$(element).parents('.control-group').addClass('error');
		},
		unhighlight: function(element, errorClass, validClass) {
			$(element).parents('.control-group').removeClass('error');
			$(element).parents('.control-group').addClass('success');
		},

        submitHandler: function(form) {  //通过之后回调
            var param = $("#modifypwd").serialize();
            $.ajax({
                url : "modifypwd.html",
                type : "post",
                dataType : "json",
                data: param,
                success : function(result) {
                    bootbox.dialog({
                        message: result.info,
                        buttons: {
                            "success" : {
                                "label" : "确定",
                                "className" : "btn-sm btn-primary"
                            }
                        }
                    });
                }
            });
        },
        invalidHandler: function(form, validator) {  //不通过回调
            return false;
        }
	});

    $('#a1').each(function() {
        $(this).qtip({
            content: {
                text: $('.tooltiptext'),
                title: '权限详细信息'
            },
            style: {
                classes: 'qtip-blue qtip-shadow'
            }
        });
    });

});
